package nz.ac.massey.groupproject.ecs2;


/*
   Different libraries have different nitty gritty details. Sometimes, even
   different routines in the same library have inconsistent semantics (cough cough, AWT).
   This interface provides a consistent convention across underlying libraries.

   Geometry:
     Given a canvas of W x H cells, label each cell from (0,0) to (W-1,H-1),
     top to bottom, left to right. Also label each corner from (0,0) to (W,H).
     Example: the top-left cell is (0,0), and its four corners are (0,0) (1,0) (1,1) (0,1).
*/
public interface UnifiedDrawingContext {
	// Once drawing is finished, call dispose() to release resources immediately, instead of waiting for GC.
	// Depending on the underlying library, dispose() may or may not be a no-op.
	void dispose();

	void setColor(int r, int g, int b);
	void setColor(int r, int g, int b, int a);

	/* (x1,y1) specifies a corner of a cell
	   (x2,y2) specifies another corner of a cell, where (x2,y2) = (x1+w, y1+h)
	   Example:
	      w = h = 1 draws a dot at cell (x1, y1)
	      w = h = 0 doesn't draw anything
	      w = 1, h = -1 draws a dot at cell (x1, y1-1).  The bottom-left corner of this cell is (x1,y1), the top-right corner is (x1+1,y1-1).

	   fillRect colors every cell inside specified rectangle.
	   drawRect colors cells that are inside specified rectangle and touching the edge of the rectangle.
	*/
	void fillRect(int x1, int y1, int w, int h);
	void drawRect(int x1, int y1, int w, int h);

	// XXX currently not precisely specified.
	void fillPolygon(int[] xs, int[] ys);
}
